home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 April: Mac OS SDK / Dev.CD Apr 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / ATA.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-06  |  52.3 KB  |  1,019 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ATA.h
  3.  
  4.      Contains:    ATA (PC/AT Attachment) Interfaces
  5.  
  6.      Version:    System 7.5
  7.                  Package:    Universal Interfaces 2.1.3
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __ATA__
  21. #define __ATA__
  22.  
  23. #ifndef __TYPES__
  24. #include <Types.h>
  25. #endif
  26. #ifndef __MIXEDMODE__
  27. #include <MixedMode.h>
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if PRAGMA_IMPORT_SUPPORTED
  35. #pragma import on
  36. #endif
  37.  
  38. #if PRAGMA_ALIGN_SUPPORTED
  39. #pragma options align=mac68k
  40. #endif
  41.  
  42. /* This is the structure used for the AT Interface core routines below */
  43.  
  44. enum {
  45.     kATATrap                    = 0xAAF1,                        /* Manager trap number <This should be defined in Traps.h>*/
  46.     kATAPBVers1                    = 0x01,                            /* parameter block version number 1*/
  47.     kATAPBVers2                    = 0x02,                            /* parameter block version number for structures*/
  48.     kATAPBVers3                    = 0x03,                            /* parameter block version for ATA times*/
  49.     kATADefaultBlockSize        = 512                            /* default block size*/
  50. };
  51.  
  52. /* Used to determine the presence of traps*/
  53.  
  54. enum {
  55.     kFSMTrap                    = 0xAC,
  56.     mDQEChanged                    = 1                                /* DQE has changed */
  57. };
  58.  
  59. /* Task file definition ••• Error Register •••*/
  60.  
  61. enum {
  62.     bATABadBlock                = 7,                            /* bit number of bad block error bit*/
  63.     bATAUncorrectable            = 6,                            /* bit number of uncorrectable error bit*/
  64.     bATAMediaChanged            = 5,                            /* bit number of media changed indicator*/
  65.     bATAIDNotFound                = 4,                            /* bit number of ID not found error bit*/
  66.     bATAMediaChangeReq            = 3,                            /* bit number of media changed request*/
  67.     bATACommandAborted            = 2,                            /* bit number of command abort bit*/
  68.     bATATrack0NotFound            = 1,                            /* bit number of track not found*/
  69.     bATAAddressNotFound            = 0,                            /* bit number of address mark not found*/
  70.     mATABadBlock                = 1 << bATABadBlock,            /* Bad Block Detected*/
  71.     mATAUncorrectable            = 1 << bATAUncorrectable,        /* Uncorrectable Data Error*/
  72.     mATAMediaChanged            = 1 << bATAMediaChanged,        /* Media Changed Indicator (for removable)*/
  73.     mATAIDNotFound                = 1 << bATAIDNotFound,            /* ID Not Found*/
  74.     mATAMediaChangeReq            = 1 << bATAMediaChangeReq,        /* Media Change Requested (NOT IMPLEMENTED)*/
  75.     mATACommandAborted            = 1 << bATACommandAborted,        /* Aborted Command*/
  76.     mATATrack0NotFound            = 1 << bATATrack0NotFound,        /* Track 0 Not Found*/
  77.     mATAAddressNotFound            = 1 << bATAAddressNotFound        /* Address Mark Not Found*/
  78. };
  79.  
  80. /* Task file definition ••• ataTFSDH Register •••*/
  81.  
  82. enum {
  83.     mATAHeadNumber                = 0x0F,                            /* Head Number (bits 0-3) */
  84.     mATASectorSize                = 0xA0,                            /* bit 7=1; bit 5 = 01 (512 sector size) <DP4>*/
  85.     mATADriveSelect                = 0x10,                            /* Drive (0 = master, 1 = slave) */
  86.     mATALBASelect                = 0x40                            /* LBA mode bit (0 = chs, 1 = LBA)*/
  87. };
  88.  
  89. /* Task file definition ••• Status Register •••*/
  90.  
  91. enum {
  92.     bATABusy                    = 7,                            /* bit number of BSY bit*/
  93.     bATADriveReady                = 6,                            /* bit number of drive ready bit*/
  94.     bATAWriteFault                = 5,                            /* bit number of write fault bit*/
  95.     bATASeekComplete            = 4,                            /* bit number of seek complete bit*/
  96.     bATADataRequest                = 3,                            /* bit number of data request bit*/
  97.     bATADataCorrected            = 2,                            /* bit number of data corrected bit*/
  98.     bATAIndex                    = 1,                            /* bit number of index mark*/
  99.     bATAError                    = 0,                            /* bit number of error bit*/
  100.     mATABusy                    = 1 << bATABusy,                /* Unit is busy*/
  101.     mATADriveReady                = 1 << bATADriveReady,            /* Unit is ready*/
  102.     mATAWriteFault                = 1 << bATAWriteFault,            /* Unit has a write fault condition*/
  103.     mATASeekComplete            = 1 << bATASeekComplete,        /* Unit seek complete*/
  104.     mATADataRequest                = 1 << bATADataRequest,            /* Unit data request*/
  105.     mATADataCorrected            = 1 << bATADataCorrected,        /* Data corrected*/
  106.     mATAIndex                    = 1 << bATAIndex,                /* Index mark - NOT USED*/
  107.     mATAError                    = 1 << bATAError                /* Error condition - see error register*/
  108. };
  109.  
  110. /* ATA Command Opcode definition*/
  111.  
  112. enum {
  113.     kATAcmdWORetry                = 0x01,                            /* Without I/O retry option*/
  114.     kATAcmdNOP                    = 0x0000,                        /* NOP operation - media detect*/
  115.     kATAcmdRecal                = 0x0010,                        /* Recalibrate command */
  116.     kATAcmdRead                    = 0x0020,                        /* Read command */
  117.     kATAcmdReadLong                = 0x0022,                        /* Read Long command*/
  118.     kATAcmdWrite                = 0x0030,                        /* Write command */
  119.     kATAcmdWriteLong            = 0x0032,                        /* Write Long*/
  120.     kATAcmdReadVerify            = 0x0040,                        /* Read Verify command */
  121.     kATAcmdFormatTrack            = 0x0050,                        /* Format Track command */
  122.     kATAcmdSeek                    = 0x0070,                        /* Seek command */
  123.     kATAcmdDiagnostic            = 0x0090,                        /* Drive Diagnostic command */
  124.     kATAcmdInitDrive            = 0x0091,                        /* Init drive parameters command */
  125.     kATAcmdReadMultiple            = 0x00C4,                        /* Read multiple*/
  126.     kATAcmdWriteMultiple        = 0x00C5,                        /* Write multiple*/
  127.     kATAcmdSetRWMultiple        = 0x00C6,                        /* Set Multiple for Read/Write Multiple*/
  128.     kATAcmdReadDMA                = 0x00C8,                        /* Read DMA (with retries)*/
  129.     kATAcmdWriteDMA                = 0x00CA,                        /* Write DMA (with retries)*/
  130.     kATAcmdMCAcknowledge        = 0x00DB,                        /* Acknowledge media change - removable*/
  131.     kATAcmdStandbyImmed            = 0x00E0,                        /* Standby Immediate*/
  132.     kATAcmdIdleImmed            = 0x00E1,                        /* Idle Immediate*/
  133.     kATAcmdStandby                = 0x00E2,                        /* Standby*/
  134.     kATAcmdIdle                    = 0x00E3,                        /* Idle*/
  135.     kATAcmdReadBuffer            = 0x00E4,                        /* Read sector buffer command */
  136.     kATAcmdCheckPowerMode        = 0x00E5,                        /* Check power mode command    <04/04/94>*/
  137.     kATAcmdSleep                = 0x00E6,                        /* Sleep*/
  138.     kATAcmdWriteBuffer            = 0x00E8,                        /* Write sector buffer command */
  139.     kATAcmdDriveIdentify        = 0x00EC,                        /* Identify Drive command */
  140.     kATAcmdSetFeatures            = 0x00EF                        /* Set Features*/
  141. };
  142.  
  143. /* Set feature command opcodes*/
  144.  
  145. enum {
  146.     kATAEnableWriteCache        = 0x02,                            /*        Enable write cache*/
  147.     kATASetTransferMode            = 0x03,                            /*        Set transfer mode*/
  148.     kATASetPIOMode                = 0x08,                            /*        PIO Flow Control Tx Mode bit*/
  149.     kATAEnableECC                = 0x88,                            /*        ECC enable*/
  150.     kATAEnableRetry                = 0x99,                            /*        Retry enable*/
  151.     kATAEnableReadAhead            = 0xAA                            /*        Read look-ahead enable*/
  152. };
  153.  
  154. /* ATA Device ID codes*/
  155.  
  156. enum {
  157.     kATAInvalidDeviceID            = -1,
  158.     kATAMasterDeviceID            = 0,
  159.     kATASlaveDeviceID            = 1
  160. };
  161.  
  162. /* Device Register Images  (8 bytes) */
  163. struct ataTaskFile {
  164.     UInt8                             ataTFFeatures;                /* <-> Error(R) or ataTFFeatures(W) register image */
  165.     UInt8                             ataTFCount;                    /* <-> Sector count/remaining */
  166.     UInt8                             ataTFSector;                /* <-> Sector start/finish */
  167.     UInt8                             ataTFReserved;                /* reserved                    */
  168.     UInt16                             ataTFCylinder;                /* <-> ataTFCylinder (Big endian) */
  169.     UInt8                             ataTFSDH;                    /* <-> ataTFSDH register image*/
  170.     UInt8                             ataTFCommand;                /* <-> Status(R) or Command(W) register image */
  171. };
  172. typedef struct ataTaskFile ataTaskFile;
  173.  
  174. /* ATA Manager Function Code Definition*/
  175.  
  176. enum {
  177.     kATAMgrNOP                    = 0x00,                            /* No Operation*/
  178.     kATAMgrExecIO                = 0x01,                            /* Execute ATA I/O*/
  179.     kATAMgrBusInquiry            = 0x03,                            /* Bus Inquiry*/
  180.     kATAMgrQRelease                = 0x04,                            /* I/O Queue Release*/
  181.     kATAMgrAbort                = 0x10,                            /* Abort command*/
  182.     kATAMgrBusReset                = 0x11,                            /* Reset ATA bus*/
  183.     kATAMgrRegAccess            = 0x12,                            /* Register Access*/
  184.     kATAMgrDriveIdentify        = 0x13,                            /* Drive Identify            <DP03/10/94>*/
  185.     kATAMgrDriverLoad            = 0x82,                            /* Load driver from either Media, ROM, etc.*/
  186.     kATAMgrDriveRegister        = 0x85,                            /* Register a driver        <4/18/94>*/
  187.     kATAMgrFindDriverRefnum        = 0x86,                            /* lookup a driver refnum    <4/18/94>*/
  188.     kATAMgrRemoveDriverRefnum    = 0x87,                            /* De-register a driver    <4/18/94>*/
  189.     kATAMgrModifyEventMask        = 0x88,                            /* Modify driver event mask*/
  190.     kATAMgrDriveEject            = 0x89,                            /* Eject the drive        <8/1/94>*/
  191.     kATAMgrGetDrvConfiguration    = 0x8A,                            /* Get device configuration    <8/6/94>*/
  192.     kATAMgrSetDrvConfiguration    = 0x8B,                            /* Set device configuration <8/6/94>*/
  193.     kATAMgrGetLocationIcon        = 0x8C,                            /* Get card location icon    <SM4>*/
  194.     kATAMgrManagerInquiry        = 0x90,                            /* Manager Inquiry*/
  195.     kATAMgrManagerInit            = 0x91,                            /* Manager initialization*/
  196.     kATAMgrManagerShutdown        = 0x92                            /* Manager ShutDown*/
  197. };
  198.  
  199. /* 'ATAFlags' field of the PB header definition*/
  200.  
  201. enum {
  202.     bATAFlagUseConfigSpeed        = 15,                            /* bit number of use default speed flag*/
  203.     bATAFlagByteSwap            = 14,                            /* bit number of byte swap flag*/
  204.     bATAFlagIORead                = 13,                            /* bit number of I/O read flag*/
  205.     bATAFlagIOWrite                = 12,                            /* bit number of I/O write flag*/
  206.     bATAFlagImmediate            = 11,                            /* bit number of immediate flag*/
  207.     bATAFlagQLock                = 10,                            /* bit number of que lock on error*/
  208.     bATAFlagScatterGather1        = 9,                            /* bit number of scatter gather*/
  209.     bATAFlagScatterGather0        = 8,                            /* bit numbers of scatter gather*/
  210.     bATAFlagUseDMA                = 7,                            /* bit number of use DMA flag*/
  211.     bATAFlagProtocol1            = 5,                            /* bit number of scatter gather*/
  212.     bATAFlagProtocol0            = 4,                            /* bit numbers of protocol specifier*/
  213.     bATAFlagTFRead                = 3,                            /* bit number of register update*/
  214.     bATAFlagLEDEnable            = 0,                            /* bit number of LED enable*/
  215.     mATAFlagUseConfigSpeed        = 1 << bATAFlagUseConfigSpeed,
  216.     mATAFlagByteSwap            = 1 << bATAFlagByteSwap,        /* Swap data bytes (read - after; write - before)*/
  217.     mATAFlagIORead                = 1 << bATAFlagIORead,            /* Read (in) operation*/
  218.     mATAFlagIOWrite                = 1 << bATAFlagIOWrite,            /* Write (out) operation*/
  219.     mATAFlagImmediate            = 1 << bATAFlagImmediate,        /* Head of Que; Immediate operation*/
  220.     mATAFlagQLock                = 1 << bATAFlagQLock,            /* Manager queue lock on error (freeze the queue)*/
  221.     mATAFlagScatterGather1        = 1 << bATAFlagScatterGather1,
  222.     mATAFlagScatterGather0        = 1 << bATAFlagScatterGather0,    /* Scatter gather enable*/
  223.     mATAFlagScatterGathers        = mATAFlagScatterGather1 + mATAFlagScatterGather0, /* host scatter gather type = currently type 1 supported*/
  224.     mATAFlagUseDMA                = 1 << bATAFlagUseDMA,
  225.     mATAFlagProtocol1            = 1 << bATAFlagProtocol1,        /* ATAPI protocol indicator <06/15/94>*/
  226.     mATAFlagProtocol0            = 1 << bATAFlagProtocol0,        /* PCMCIA protocol indicator <06/15/94>*/
  227.     mATAFlagProtocols            = mATAFlagProtocol1 + mATAFlagProtocol0, /* mask for protocol type field    <06/15/94>*/
  228.     mATAFlagTFRead                = 1 << bATAFlagTFRead,            /* update reg block request upon detection of an error*/
  229.     mATAFlagLEDEnable            = 1 << bATAFlagLEDEnable        /* socket LED enable*/
  230. };
  231.  
  232. /* Parameter block header definition - common for all PBs (48 bytes)*/
  233. typedef struct ataPBHeader ataPBHeader;
  234. struct ataPBHeader {
  235.                                                                 /* Start of cloned common header ataPBHdr */
  236.     struct ataPBHeader *            ataPBLink;                    /* a pointer to the next entry in the queue    */
  237.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  238.     UInt8                             ataPBVers;                    /* -->: parameter block version number*/
  239.     UInt8                             ataPBReserved;                /* Reserved                                        */
  240.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  241.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  242.     OSErr                             ataPBResult;                /* <--: Returned result                */
  243.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  244.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  245.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  246.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  247.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  248.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  249.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  250.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  251.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  252.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  253.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  254.                                                                 /* End of cloned common header ataPBHdr*/
  255. };
  256. typedef struct ataPBHeader ataPBHeader;
  257.  
  258. /* data request entry structure (16 bytes)*/
  259. struct IOBlock {
  260.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  261.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  262. };
  263. typedef struct IOBlock IOBlock;
  264.  
  265. /*
  266.  For ATAPI devices the ExtendedPB field is a pointer to the Command Packet
  267.  record which exists of an array of words structured as follows…    <06/15/94>
  268. */
  269. struct ATAPICmdPacket {
  270.     SInt16                             atapiPacketSize;            /* Size of command packet in bytes    <06/15/94>*/
  271.     SInt16                             atapiCommandByte[8];        /* The command packet itself    <06/15/94>*/
  272. };
  273. typedef struct ATAPICmdPacket ATAPICmdPacket;
  274.  
  275. /* Manager parameter block structure (96 bytes)*/
  276. struct ataIOPB {
  277.                                                                 /* Start of cloned common header ataPBHdr*/
  278.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  279.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  280.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  281.     UInt8                             ataPBReserved;                /* Reserved                                        */
  282.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  283.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  284.     OSErr                             ataPBResult;                /* <--: Returned result                */
  285.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  286.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  287.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  288.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  289.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  290.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  291.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  292.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  293.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  294.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  295.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  296.                                                                 /* End of cloned common header ataPBHdr*/
  297.     SInt8                             ataPBStatusRegister;        /* <--: Last ATA status image*/
  298.     SInt8                             ataPBErrorRegister;            /* <--: Last ATA error image-valid if lsb of Status set*/
  299.     SInt16                             ataPBReserved5;                /* Reserved*/
  300.     UInt32                             ataPBLogicalBlockSize;        /* -->: Blind transfer size per interrupt (Logical block size)*/
  301.     UInt8 *                            ataPBBuffer;                /* -->: Data buffer pointer*/
  302.     UInt32                             ataPBByteCount;                /* -->: Data transfer length in bytes*/
  303.     UInt32                             ataPBActualTxCount;            /* <--: Actual transfer count*/
  304.     UInt32                             ataPBReserved6;                /* Reserved*/
  305.     ataTaskFile                     ataPBTaskFile;                /* <->:    Device register images*/
  306.     ATAPICmdPacket *                ataPBPacketPtr;                /* -->: ATAPI packet command block pointer (valid with ATAPI bit set)*/
  307.     SInt16                             ataPBReserved7[6];            /* Reserved for future expansion*/
  308. };
  309. typedef struct ataIOPB ataIOPB;
  310.  
  311. /*
  312.  Parameter block structure for bus and Manager inquiry command
  313.  Manager parameter block structure
  314. */
  315. struct ataBusInquiry {
  316.                                                                 /* Start of cloned common header ataPBHdr*/
  317.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  318.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  319.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  320.     UInt8                             ataPBReserved;                /* Reserved                                        */
  321.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  322.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  323.     OSErr                             ataPBResult;                /* <--: Returned result                */
  324.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  325.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  326.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  327.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  328.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  329.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  330.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  331.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  332.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  333.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  334.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  335.                                                                 /* End of cloned common header ataPBHdr*/
  336.     UInt16                             ataEngineCount;                /* <--: TBD; zero for now*/
  337.     UInt16                             ataReserved1;                /* Reserved*/
  338.     UInt32                             ataDataTypes;                /* <--: TBD; zero for now*/
  339.     UInt16                             ataIOpbSize;                /* <--: Size of ATA IO PB*/
  340.     UInt16                             ataMaxIOpbSize;                /* <--: TBD; zero for now*/
  341.     UInt32                             ataFeatureFlags;            /* <--: TBD*/
  342.     UInt8                             ataVersionNum;                /* <--: Version number for the HBA*/
  343.     UInt8                             ataHBAInquiry;                /* <--: TBD; zero for now*/
  344.     UInt16                             ataReserved2;                /* Reserved*/
  345.     UInt32                             ataHBAPrivPtr;                /* <--: Ptr to HBA private data area*/
  346.     UInt32                             ataHBAPrivSize;                /* <--: Size of HBA private data area*/
  347.     UInt32                             ataAsyncFlags;                /* <--: Event capability for callback*/
  348.     UInt8                             ataPIOModes;                /* <--: PIO modes supported (bit-significant)*/
  349.     UInt8                             ataReserved3;                /* Reserved*/
  350.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported (b-sig)    */
  351.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported (b-sig)*/
  352.     UInt32                             ataReserved4[4];            /* Reserved*/
  353.     SInt8                             ataReserved5[16];            /* TBD*/
  354.     SInt8                             ataHBAVendor[16];            /* <--: Vendor ID of the HBA*/
  355.     SInt8                             ataContrlFamily[16];        /* <--: Family of ATA Controller*/
  356.     SInt8                             ataContrlType[16];            /* <--: Model number of controller*/
  357.     SInt8                             ataXPTversion[4];            /* <--: version number of XPT*/
  358.     SInt8                             ataReserved6[4];            /* Reserved*/
  359.     SInt8                             ataHBAversion[4];            /* <--: version number of HBA*/
  360.     UInt8                             ataHBAslotType;                /* <--: type of slot*/
  361.     UInt8                             ataHBAslotNum;                /* <--: slot number of the HBA*/
  362.     UInt16                             ataReserved7;                /* Reserved*/
  363.     UInt32                             ataReserved8;                /* Reserved*/
  364. };
  365. typedef struct ataBusInquiry ataBusInquiry;
  366.  
  367. /* Manager parameter block structure*/
  368. struct ataMgrInquiry {
  369.                                                                 /* Start of cloned common header ataPBHdr*/
  370.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  371.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  372.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  373.     UInt8                             ataPBReserved;                /* Reserved                                        */
  374.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  375.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  376.     OSErr                             ataPBResult;                /* <--: Returned result                */
  377.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  378.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  379.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  380.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  381.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  382.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  383.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  384.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  385.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  386.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  387.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  388.                                                                 /* End of cloned common header ataPBHdr*/
  389.     NumVersion                         ataMgrVersion;                /* Manager Version information*/
  390.     UInt8                             ataMgrPBVers;                /* <--: Manager PB version number supported*/
  391.     UInt8                             Reserved1;                    /* Reserved*/
  392.     UInt16                             ataBusCnt;                    /* <--: Number of ATA buses in the system*/
  393.     UInt16                             ataDevCnt;                    /* <--: Total number of ATA devices detected*/
  394.     UInt8                             ataPioModes;                /* <--: Maximum Programmed I/O speed mode supported*/
  395.     UInt8                             Reserved2;                    /* Reserved*/
  396.     UInt16                             ataIOClkResolution;            /* <--: IO Clock resolution in nsec (Not supported)*/
  397.     UInt8                             ataSingleDMAModes;            /* <--: Single Word DMA modes supported    */
  398.     UInt8                             ataMultiDMAModes;            /* <--: Multiword DMA modes supported*/
  399.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  400. };
  401. typedef struct ataMgrInquiry ataMgrInquiry;
  402.  
  403. /*
  404.  Parameter block structure for Abort command
  405.  Manager parameter block structure
  406. */
  407. struct ataAbort {
  408.                                                                 /* Start of cloned common header ataPBHdr*/
  409.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  410.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  411.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  412.     UInt8                             ataPBReserved;                /* Reserved                                        */
  413.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  414.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  415.     OSErr                             ataPBResult;                /* <--: Returned result                */
  416.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  417.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  418.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  419.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  420.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  421.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  422.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  423.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  424.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  425.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  426.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  427.                                                                 /* End of cloned common header ataPBHdr*/
  428.     ataIOPB *                        ataAbortPB;                    /* -->: Parameter block to be aborted*/
  429.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  430. };
  431. typedef struct ataAbort ataAbort;
  432.  
  433. /* Manager parameter block structure*/
  434. struct ATAEventRec {
  435.     UInt16                             ataEventCode;                /* --> ATA event code*/
  436.     UInt16                             ataPhysicalID;                /* --> Physical drive reference*/
  437.     SInt32                             ataDrvrContext;                /* Context pointer saved by driver*/
  438. };
  439. typedef struct ATAEventRec ATAEventRec;
  440.  
  441. typedef ATAEventRec *ATAEventRecPtr;
  442. typedef pascal SInt16 (*ATAClientProcPtr)(ATAEventRecPtr ataERPtr);
  443.  
  444. #if GENERATINGCFM
  445. typedef UniversalProcPtr ATAClientUPP;
  446. #else
  447. typedef ATAClientProcPtr ATAClientUPP;
  448. #endif
  449.  
  450. enum {
  451.     uppATAClientProcInfo = kPascalStackBased
  452.          | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
  453.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ATAEventRecPtr)))
  454. };
  455.  
  456. #if GENERATINGCFM
  457. #define NewATAClientProc(userRoutine)        \
  458.         (ATAClientUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppATAClientProcInfo, GetCurrentArchitecture())
  459. #else
  460. #define NewATAClientProc(userRoutine)        \
  461.         ((ATAClientUPP) (userRoutine))
  462. #endif
  463.  
  464. #if GENERATINGCFM
  465. #define CallATAClientProc(userRoutine, ataERPtr)        \
  466.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppATAClientProcInfo, (ataERPtr))
  467. #else
  468. #define CallATAClientProc(userRoutine, ataERPtr)        \
  469.         (*(userRoutine))((ataERPtr))
  470. #endif
  471. /*
  472.  Parameter block structure for Driver Register command
  473.  Manager parameter block structure
  474. */
  475. struct ataDrvrRegister {
  476.                                                                 /* Start of cloned common header ataPBHdr*/
  477.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  478.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  479.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  480.     UInt8                             ataPBReserved;                /* Reserved                                        */
  481.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  482.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  483.     OSErr                             ataPBResult;                /* <--: Returned result                */
  484.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  485.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  486.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  487.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  488.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  489.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  490.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  491.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  492.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  493.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  494.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  495.                                                                 /* End of cloned common header ataPBHdr*/
  496.     SInt16                             ataDrvrRefNum;                /* <->: Driver reference number*/
  497.     UInt16                             ataDrvrFlags;                /* -->: 1 = loader driver if ataPBDeviceID = -1 {PB2}*/
  498.     UInt16                             ataDeviceNextID;            /* <--: used to specified the next drive ID*/
  499.     SInt16                             ataDrvrLoadPriv;            /* Driver loader private storage*/
  500.     ATAClientUPP                     ataEventHandler;            /* <->: Pointer to ATA event callback routine {PB2}*/
  501.     SInt32                             ataDrvrContext;                /* <->: Context data saved by driver {PB2}*/
  502.     SInt32                             ataEventMask;                /* <->: Set to 1 for notification of event {PB2}*/
  503.     SInt16                             Reserved[14];                /* Reserved for future expansion - from [21] {PB2}*/
  504. };
  505. typedef struct ataDrvrRegister ataDrvrRegister;
  506.  
  507. /* Parameter block structure for Modify driver event mask command*/
  508. struct ataModifyEventMask {
  509.                                                                 /* Start of cloned common header ataPBHdr*/
  510.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  511.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  512.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  513.     UInt8                             ataPBReserved;                /* Reserved                                        */
  514.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  515.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  516.     OSErr                             ataPBResult;                /* <--: Returned result                */
  517.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  518.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  519.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  520.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  521.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  522.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  523.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  524.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  525.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  526.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  527.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  528.                                                                 /* End of cloned common header ataPBHdr*/
  529.     SInt32                             ataModifiedEventMask;        /* -->: new event mask value*/
  530.     SInt16                             Reserved[22];                /* Reserved for future expansion*/
  531. };
  532. typedef struct ataModifyEventMask ataModifyEventMask;
  533.  
  534. /* 'ataRegMask' field of the ataRegAccess definition*/
  535.  
  536. enum {
  537.     bATAAltSDevCValid            = 14,                            /* bit number of alternate status/device cntrl valid bit*/
  538.     bATAStatusCmdValid            = 7,                            /* bit number of status/command valid bit*/
  539.     bATASDHValid                = 6,                            /* bit number of ataTFSDH valid bit*/
  540.     bATACylinderHiValid            = 5,                            /* bit number of cylinder high valid bit*/
  541.     bATACylinderLoValid            = 4,                            /* bit number of cylinder low valid bit*/
  542.     bATASectorNumValid            = 3,                            /* bit number of sector number valid bit*/
  543.     bATASectorCntValid            = 2,                            /* bit number of sector count valid bit*/
  544.     bATAErrFeaturesValid        = 1,                            /* bit number of error/features valid bit*/
  545.     bATADataValid                = 0,                            /* bit number of data valid bit*/
  546.     mATAAltSDevCValid            = 1 << bATAAltSDevCValid,        /* alternate status/device control valid*/
  547.     mATAStatusCmdValid            = 1 << bATAStatusCmdValid,        /* status/command valid*/
  548.     mATASDHValid                = 1 << bATASDHValid,            /* ataTFSDH valid*/
  549.     mATACylinderHiValid            = 1 << bATACylinderHiValid,        /* cylinder high valid*/
  550.     mATACylinderLoValid            = 1 << bATACylinderLoValid,        /* cylinder low valid*/
  551.     mATASectorNumValid            = 1 << bATASectorNumValid,        /* sector number valid*/
  552.     mATASectorCntValid            = 1 << bATASectorCntValid,        /* sector count valid*/
  553.     mATAErrFeaturesValid        = 1 << bATAErrFeaturesValid,    /* error/features valid*/
  554.     mATADataValid                = 1 << bATADataValid            /* data valid*/
  555. };
  556.  
  557. /* Parameter block structure for device register access command*/
  558. union ataRegValueUnion {
  559.     UInt8                             ataByteRegValue;            /* <->: Byte register value read or to be written*/
  560.     UInt16                             ataWordRegValue;            /* <->: Word register value read or to be written*/
  561. };
  562. typedef union ataRegValueUnion ataRegValueUnion;
  563.  
  564. /* Manager parameter block structure*/
  565. struct ataRegAccess {
  566.                                                                 /* Start of cloned common header ataPBHdr*/
  567.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  568.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  569.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  570.     UInt8                             ataPBReserved;                /* Reserved                                        */
  571.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  572.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  573.     OSErr                             ataPBResult;                /* <--: Returned result                */
  574.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  575.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  576.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  577.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  578.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  579.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  580.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  581.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  582.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  583.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  584.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  585.                                                                 /* End of cloned common header ataPBHdr*/
  586.     UInt16                             ataRegSelect;                /* -->: Device Register Selector*/
  587.                                                                 /*            DataReg            0    */
  588.                                                                 /*            ErrorReg(R) or FeaturesReg(W)    1*/
  589.                                                                 /*            SecCntReg        2*/
  590.                                                                 /*            SecNumReg        3*/
  591.                                                                 /*            CylLoReg        4*/
  592.                                                                 /*            CylHiReg        5*/
  593.                                                                 /*            SDHReg            6*/
  594.                                                                 /*            StatusReg(R) or CmdReg(W)        7*/
  595.                                                                 /*            AltStatus(R) or DevCntr(W)    0E*/
  596.     ataRegValueUnion                 ataRegValue;
  597.                                                                 /* Following fields are valid only if ataRegSelect = 0xFFFF*/
  598.     UInt16                             ataRegMask;                    /* -->: mask for register(s) to update*/
  599.                                                                 /*        bit 0 : data register valid*/
  600.                                                                 /*        bit 1 : error/feaures register valid*/
  601.                                                                 /*        bit 2 : sector count register valid*/
  602.                                                                 /*        bit 3 : sector number register valid*/
  603.                                                                 /*        bit 4 : cylinder low register valid*/
  604.                                                                 /*        bit 5 : cylinder high register valid*/
  605.                                                                 /*        bit 6 : ataTFSDH register valid*/
  606.                                                                 /*        bit 7 : status/command register valid*/
  607.                                                                 /*        bits 8 - 13 : reserved (set to 0)*/
  608.                                                                 /*        bit 14: alternate status / device control reg valid*/
  609.                                                                 /*         bit 15: reserved (set to 0)*/
  610.     ataTaskFile                     ataRegisterImage;            /* <->: register images*/
  611.     UInt8                             ataAltSDevCReg;                /* <->: Alternate status(R) or Device Control(W) register image*/
  612.     UInt8                             Reserved3;                    /* Reserved*/
  613.     SInt16                             Reserved[16];                /* Reserved for future expansion*/
  614. };
  615. typedef struct ataRegAccess ataRegAccess;
  616.  
  617. /* Manager parameter block structure    <DP03/10/94>*/
  618. struct ataIdentify {
  619.                                                                 /* Start of cloned common header ataPBHdr*/
  620.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  621.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  622.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  623.     UInt8                             ataPBReserved;                /* Reserved                                        */
  624.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  625.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  626.     OSErr                             ataPBResult;                /* <--: Returned result                */
  627.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  628.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  629.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  630.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  631.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  632.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  633.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  634.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  635.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  636.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  637.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  638.                                                                 /* End of cloned common header ataPBHdr*/
  639.     UInt16                             Reserved1[4];                /* Reserved.  These are used internally by the Manager*/
  640.     UInt8 *                            ataPBBuffer;                /* Buffer for the identify data (512 bytes)*/
  641.     UInt16                             Reserved2[12];                /* Used internally by the ATA Manager*/
  642.     SInt16                             Reserved3[6];                /* Reserved for future expansion*/
  643. };
  644. typedef struct ataIdentify ataIdentify;
  645.  
  646. /* 'ataConfigSetting' field of the Get/Set Device Configuration definition <8/6/94>*/
  647.  
  648. enum {
  649.     ATAPIpacketDRQ_bit            = 6,                            /* bit number of ATAPI command packet DRQ option*/
  650.     ATAPIpacketDRQ                = 1 << ATAPIpacketDRQ_bit        /* ATAPI command packet DRQ option*/
  651. };
  652.  
  653. /* atapcValid field definition*/
  654.  
  655. enum {
  656.     bATApcAccessMode            = 0,
  657.     bATApcVcc                    = 1,
  658.     bATApcVpp1                    = 2,
  659.     bATApcVpp2                    = 3,
  660.     bATApcStatus                = 4,
  661.     bATApcPin                    = 5,
  662.     bATApcCopy                    = 6,
  663.     bATApcConfigIndex            = 7,
  664.     bATApcLockUnlock            = 15,
  665.     mATApcAccessMode            = 1 << bATApcAccessMode,
  666.     mATApcVcc                    = 1 << bATApcVcc,
  667.     mATApcVpp1                    = 1 << bATApcVpp1,
  668.     mATApcVpp2                    = 1 << bATApcVpp2,
  669.     mATApcStatus                = 1 << bATApcStatus,
  670.     mATApcPin                    = 1 << bATApcPin,
  671.     mATApcCopy                    = 1 << bATApcCopy,
  672.     mATApcConfigIndex            = 1 << bATApcConfigIndex,
  673.     mATApcLockUnlock            = 1 << bATApcLockUnlock
  674. };
  675.  
  676. /* Device physical type & socket type indicator definition*/
  677.  
  678. enum {
  679.     kATADeviceUnknown            = 0x00,                            /* no device or type undetermined*/
  680.     kATADeviceATA                = 0x01,                            /* traditional ATA protocol device <7/29/94>*/
  681.     kATADeviceATAPI                = 0x02,                            /* ATAPI protocol device    <7/29/94>*/
  682.     kATADevicePCMCIA            = 0x03,                            /* PCMCIA ATA device        <7/29/94>*/
  683.     kATASocketInternal            = 0x01,                            /* Internal ATA socket*/
  684.     kATASocketMB                = 0x02,                            /* Media Bay socket*/
  685.     kATASocketPCMCIA            = 0x03,                            /* PCMCIA socket*/
  686.     kATAConfigReserved            = 7                                /* number of reserved words at the end*/
  687. };
  688.  
  689. /*
  690.  Get/Set Device Configuration parameter block structure <8/6/94>
  691.  Manager parameter block structure
  692. */
  693. struct ataDevConfiguration {
  694.                                                                 /* Start of cloned common header ataPBHdr*/
  695.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  696.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  697.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  698.     UInt8                             ataPBReserved;                /* Reserved                                        */
  699.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  700.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  701.     OSErr                             ataPBResult;                /* <--: Returned result                */
  702.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  703.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  704.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  705.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  706.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  707.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  708.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  709.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  710.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  711.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  712.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  713.                                                                 /* End of cloned common header ataPBHdr*/
  714.     SInt32                             ataConfigSetting;            /* <->: Configuration setting*/
  715.                                                                 /*      Bits 3 - 0: Reserved*/
  716.                                                                 /*      Bit 4: Reserved (allowLBAAccess)*/
  717.                                                                 /*      Bit 5: Reserved (allowRWMultiple)*/
  718.                                                                 /*      Bit 6: ATAPIpacketDRQ*/
  719.                                                                 /*        1 = Check for Interrupt DRQ on ATAPI command packet DRQ*/
  720.                                                                 /*        0 = Default: Check only for the assertion of command packet DRQ*/
  721.                                                                 /*      Bits 31 - 7: Reserved*/
  722.     UInt8                             ataPIOSpeedMode;            /* <->: Device access speed in PIO Mode*/
  723.     UInt8                             Reserved3;                    /* Reserved to force word alignment*/
  724.     UInt16                             atapcValid;                    /* <->: Set when pcXXX fields are valid (atapcAccessMode - atapcConfigIndex)*/
  725.                                                                 /*        bit 0 - atapcAccessMode field valid, when set*/
  726.                                                                 /*        bit 1 - atapcVcc field valid, when set*/
  727.                                                                 /*        bit 2 - atapcVpp1 field valid, when set*/
  728.                                                                 /*        bit 3 - atapcVpp2 field valid, when set*/
  729.                                                                 /*        bit 4 - atapcStatus field valid, when set*/
  730.                                                                 /*        bit 5 - atapcPin field valid, when set*/
  731.                                                                 /*        bit 6 - atapcCopy field valid, when set*/
  732.                                                                 /*        bit 7 - atapcConfigIndex field valid, when set*/
  733.                                                                 /*        bits 14-8 - Reserved*/
  734.                                                                 /*        bit 15 - device lock/unlock request (write only)*/
  735.     UInt16                             ataRWMultipleCount;            /* Reserved for future (not supported yet)*/
  736.     UInt16                             ataSectorsPerCylinder;        /* Reserved for future (not supported yet)*/
  737.     UInt16                             ataHeads;                    /* Reserved for future (not supported yet)*/
  738.     UInt16                             ataSectorsPerTrack;            /* Reserved for future (not supported yet)*/
  739.     UInt16                             ataSocketNumber;            /* <--: Socket number used by the CardServices*/
  740.                                                                 /*        0xFF = socket number invalid (Not a CardServices device)*/
  741.                                                                 /*        other = socket number of the device*/
  742.     UInt8                             ataSocketType;                /* <--: Specifies the socket type (get config only)*/
  743.                                                                 /*        00 = Unknown socket*/
  744.                                                                 /*         01 = Internal ATA bus*/
  745.                                                                 /*        02 = Media Bay*/
  746.                                                                 /*        03 = PCMCIA*/
  747.     UInt8                             ataDeviceType;                /* <--: Specifies the device type (get config only)*/
  748.                                                                 /*        00 = Unknown device*/
  749.                                                                 /*        01 = standard ATA device (HD)*/
  750.                                                                 /*        02 = ATAPI device*/
  751.                                                                 /*        03 = PCMCIA ATA device*/
  752.     UInt8                             atapcAccessMode;            /* <->: Access mode: Memory vs. I/O (PCMCIA only)*/
  753.     UInt8                             atapcVcc;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  754.     UInt8                             atapcVpp1;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  755.     UInt8                             atapcVpp2;                    /* <->: Voltage in tenths of a volt (PCMCIA only)*/
  756.     UInt8                             atapcStatus;                /* <->: Card Status register setting (PCMCIA only)*/
  757.     UInt8                             atapcPin;                    /* <->: Card Pin register setting (PCMCIA only)*/
  758.     UInt8                             atapcCopy;                    /* <->: Card Socket/Copy register setting (PCMCIA only)*/
  759.     UInt8                             atapcConfigIndex;            /* <->: Card Option register setting (PCMCIA only)*/
  760.     UInt8                             ataSingleDMASpeed;            /* <->: Single Word DMA Timing Class*/
  761.     UInt8                             ataMultiDMASpeed;            /* <->: Multiple Word DMA Timing Class*/
  762.     UInt16                             ataPIOCycleTime;            /* <->:Cycle time for PIO mode*/
  763.     UInt16                             ataMultiCycleTime;            /* <->:Cycle time for Multiword DMA mode*/
  764.     UInt16                             Reserved1[7];                /* Reserved for future*/
  765. };
  766. typedef struct ataDevConfiguration ataDevConfiguration;
  767.  
  768. /* Get Card Location Icon/Text    <SM4>*/
  769.  
  770. enum {
  771.     kATALargeIconHFS            = 0x0001,                        /* Large B&W icon with mask (HFS)*/
  772.     kATALargeIconProDOS            = 0x0081                        /* Large B&W icon with mask (ProDOS)*/
  773. };
  774.  
  775. /* Manager parameter block structure*/
  776. struct ataLocationData {
  777.                                                                 /* Start of cloned common header ataPBHdr*/
  778.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  779.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  780.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  781.     UInt8                             ataPBReserved;                /* Reserved                                        */
  782.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  783.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  784.     OSErr                             ataPBResult;                /* <--: Returned result                */
  785.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  786.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  787.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  788.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  789.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  790.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  791.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  792.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  793.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  794.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  795.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  796.                                                                 /* End of cloned common header ataPBHdr*/
  797.     SInt16                             ataIconType;                /* -->: icon type specifier*/
  798.                                                                 /*         1 = Large B&W icon with mask (256 bytes)*/
  799.                                                                 /*        0x81 = Same as 1, but ProDOS icon*/
  800.     SInt16                             ataIconReserved;            /* Reserved to be longword aligned*/
  801.     SInt8 *                            ataLocationIconPtr;            /* -->: Icon Data buffer pointer*/
  802.     SInt8 *                            ataLocationStringPtr;        /* -->: Icon String buffer pointer*/
  803.     UInt16                             Reserved1[18];                /* Reserved for future*/
  804. };
  805. typedef struct ataLocationData ataLocationData;
  806.  
  807. /* ataOSType available*/
  808.  
  809. enum {
  810.     kATAddTypeMacOS                = 0x0001                        /* Blue Mac O/S ddType value*/
  811. };
  812.  
  813. /* The parameter block definition for all other ATA Manager functions.*/
  814. struct ataGeneric {
  815.                                                                 /* Start of cloned common header ataPBHdr*/
  816.     ataPBHeader *                    ataPBLink;                    /* a pointer to the next entry in the queue    */
  817.     UInt16                             ataPBQType;                    /* type byte for safety check*/
  818.     UInt8                             ataPBVers;                    /* -->: parameter block version number; Must be 0x01*/
  819.     UInt8                             ataPBReserved;                /* Reserved                                        */
  820.     Ptr                             ataPBReserved2;                /* Reserved                                        */
  821.     ProcPtr                         ataPBCallbackPtr;            /* -->: Completion Routine Pointer    */
  822.     OSErr                             ataPBResult;                /* <--: Returned result                */
  823.     UInt8                             ataPBFunctionCode;            /* -->: Manager Function Code */
  824.     UInt8                             ataPBIOSpeed;                /* -->: I/O Timing Class            */
  825.     UInt16                             ataPBFlags;                    /* -->: Various control options    */
  826.     SInt16                             ataPBReserved3;                /* Reserved                                        */
  827.     UInt32                             ataPBDeviceID;                /* -->: Device identifier            */
  828.     UInt32                             ataPBTimeOut;                /* -->: Transaction timeout value    in msec */
  829.     Ptr                             ataPBClientPtr1;            /* Client's storage Ptr 1     */
  830.     Ptr                             ataPBClientPtr2;            /* Client's storage Ptr 2     */
  831.     UInt16                             ataPBState;                    /* Reserved for Manager; Initialize to 0 */
  832.     UInt16                             ataPBSemaphores;            /* Used internally by the manager*/
  833.     SInt32                             ataPBReserved4;                /* Reserved                                        */
  834.                                                                 /* End of cloned common header ataPBHdr*/
  835.     UInt16                             Reserved[24];                /* Reserved for future*/
  836. };
  837. typedef struct ataGeneric ataGeneric;
  838.  
  839. union ataPB {
  840.     ataIOPB                         ataIOParamBlock;            /* parameter block for I/O*/
  841.     ataBusInquiry                     ataBIParamBlock;            /* parameter block for bus inquiry*/
  842.     ataMgrInquiry                     ataMIParamBlock;            /* parameter block for Manager inquiry*/
  843.     ataAbort                         ataAbortParamBlock;            /* parameter block for abort*/
  844.     ataDrvrRegister                 ataDRParamBlock;            /* parameter block for driver register*/
  845.     ataModifyEventMask                 ataMEParamBlock;            /* parameter block for event mask modify*/
  846.     ataRegAccess                     ataRAParamBlock;            /* parameter block for register access*/
  847.     ataIdentify                     ataDIParamBlock;            /* parameter block for drive identify*/
  848.     ataDevConfiguration             ataDCParamBlock;            /* parameter block for device configuration*/
  849.     ataLocationData                 ataLDParamBlock;            /* parameter block for location icon data*/
  850.                                                                 /*ataManagerInit    ataInitParamBlock;        // parameter block for Manager initialization*/
  851.                                                                 /*ataManagerShutDn    ataSDParamBlock;        // parameter block for Manager shutdown*/
  852.                                                                 /*ataDrvrLoad        ataDLParamBlock;        // parameter block for Driver loading*/
  853.     ataGeneric                         ataGenericParamBlock;        /* parameter block for all other functions*/
  854. };
  855. typedef union ataPB ataPB;
  856.  
  857. /* The ATA Event codes…*/
  858.  
  859. enum {
  860.     kATANullEvent                = 0x00,                            /* Just kidding -- nothing happened*/
  861.     kATAOnlineEvent                = 0x01,                            /* An ATA device has come online*/
  862.     kATAOfflineEvent            = 0x02,                            /* An ATA device has gone offline*/
  863.     kATARemovedEvent            = 0x03,                            /* An ATA device has been removed from the bus*/
  864.     kATAResetEvent                = 0x04,                            /* Someone gave a hard reset to the drive*/
  865.     kATAOfflineRequest            = 0x05,                            /* Someone requesting to offline the drive*/
  866.     kATAEjectRequest            = 0x06,                            /* Someone requesting to eject the drive*/
  867.     kATAUpdateEvent                = 0x07,                            /* Potential configuration change reported by CardServices <SM4>*/
  868.                                                                 /* The following describes bit definitions in the eventMask field of ataDrvrRegister*/
  869.     bATANullEvent                = 1 << kATANullEvent,            /* null event bit*/
  870.     bATAOnlineEvent                = 1 << kATAOnlineEvent,            /* online event bit*/
  871.     bATAOfflineEvent            = 1 << kATAOfflineEvent,        /* offline event bit*/
  872.     bATARemovedEvent            = 1 << kATARemovedEvent,        /* removed event bit*/
  873.     bATAResetEvent                = 1 << kATAResetEvent,            /* reset event bit*/
  874.     bATAOfflineRequest            = 1 << kATAOfflineRequest,        /* offline request event bit*/
  875.     bATAEjectRequest            = 1 << kATAEjectRequest,        /* eject request event bit*/
  876.     bATAUpdateEvent                = 1 << kATAUpdateEvent            /* configuration update event bit*/
  877. };
  878.  
  879. typedef pascal OSErr (*ATADispatchProcPtr)(ataPB *pb);
  880.  
  881. #if GENERATINGCFM
  882. typedef UniversalProcPtr ATADispatchUPP;
  883. #else
  884. typedef ATADispatchProcPtr ATADispatchUPP;
  885. #endif
  886.  
  887. enum {
  888.     uppATADispatchProcInfo = kPascalStackBased
  889.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  890.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ataPB *)))
  891. };
  892.  
  893. #if GENERATINGCFM
  894. #define NewATADispatchProc(userRoutine)        \
  895.         (ATADispatchUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppATADispatchProcInfo, GetCurrentArchitecture())
  896. #else
  897. #define NewATADispatchProc(userRoutine)        \
  898.         ((ATADispatchUPP) (userRoutine))
  899. #endif
  900.  
  901. #if GENERATINGCFM
  902. #define CallATADispatchProc(userRoutine, pb)        \
  903.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppATADispatchProcInfo, (pb))
  904. #else
  905. #define CallATADispatchProc(userRoutine, pb)        \
  906.         (*(userRoutine))((pb))
  907. #endif
  908. extern pascal SInt16 ataManager(ataPB *pb)
  909.  ONEWORDINLINE(0xAAF1);
  910.  
  911. /* Device Error codes: 0xDB42 - 0xDB5F    */
  912.  
  913. enum {
  914.     ATABaseErrCode                = -9406,                        /* Base error code - 0xDB42    */
  915.     ioPending                    = 1,                            /* Asynch I/O in progress status*/
  916.     AT_NRdyErr                    = ATABaseErrCode + 0x01,        /* 0xDB43: Drive not Ready */
  917.     AT_IDNFErr                    = ATABaseErrCode + 0x02,        /* 0xDB44: ID not found */
  918.     AT_DMarkErr                    = ATABaseErrCode + 0x03,        /* 0xDB45: Data mark not found */
  919.     AT_BadBlkErr                = ATABaseErrCode + 0x04,        /* 0xDB46: Bad Block */
  920.     AT_CorDataErr                = ATABaseErrCode + 0x05,        /* 0xDB47: Data was corrected */
  921.     AT_UncDataErr                = ATABaseErrCode + 0x06,        /* 0xDB48: Data was not corrected */
  922.     AT_SeekErr                    = ATABaseErrCode + 0x07,        /* 0xDB49: Seek error */
  923.     AT_WrFltErr                    = ATABaseErrCode + 0x08,        /* 0xDB4A: Write fault */
  924.     AT_RecalErr                    = ATABaseErrCode + 0x09,        /* 0xDB4B: Recalibrate failed */
  925.     AT_AbortErr                    = ATABaseErrCode + 0x0A,        /* 0xDB4C: Command aborted by drive */
  926.     AT_MCErr                    = ATABaseErrCode + 0x0C,        /* 0xDB4E: Media Changed error*/
  927.     ATAPICheckErr                = ATABaseErrCode + 0x0D,        /* 0xDB4F: ATAPI Check condition <06/15/94>*/
  928.                                                                 /* System error codes...Custom Driver Error Codes 0xDB60 - 0xDB6F*/
  929.     DRVRCantAllocate            = ATABaseErrCode + 0x1E,        /* 0xDB60: Allocation error during initialization*/
  930.     NoATAMgr                    = ATABaseErrCode + 0x1F,        /* 0xDB61: MgrInquiry failed => No ATA Manager*/
  931.     ATAInitFail                    = ATABaseErrCode + 0x20,        /* 0xDB62: Mgr Initialization failed*/
  932.     ATABufFail                    = ATABaseErrCode + 0x21,        /* 0xDB63: Device buffer test failure*/
  933.     ATADevUnsupported            = ATABaseErrCode + 0x22,        /* 0xDB64: Device type not supported*/
  934.     ATAEjectDrvErr                = ATABaseErrCode + 0x23,        /* 0xDB65: Could not eject the drive*/
  935.                                                                 /* Manager Error Codes 0xDB70 - 0xDB8F*/
  936.     ATAMgrNotInitialized        = ATABaseErrCode + 0x2E,        /* 0xDB70: Mgr has not been initialized*/
  937.     ATAPBInvalid                = ATABaseErrCode + 0x2F,        /* 0xDB71: The bus base address couldn't be found*/
  938.     ATAFuncNotSupported            = ATABaseErrCode + 0x30,        /* 0xDB72: An unknown function code specified*/
  939.     ATABusy                        = ATABaseErrCode + 0x31,        /* 0xDB73: Selected device is busy*/
  940.     ATATransTimeOut                = ATABaseErrCode + 0x32,        /* 0xDB74: Transaction timeout detected*/
  941.     ATAReqInProg                = ATABaseErrCode + 0x33,        /* 0xDB75: Channel busy; channel is processing another cmd*/
  942.     ATAUnknownState                = ATABaseErrCode + 0x34,        /* 0xDB76: Device status register reflects an unknown state*/
  943.     ATAQLocked                    = ATABaseErrCode + 0x35,        /* 0xDB77: I/O Queue is locked due to previous I/O error.*/
  944.     ATAReqAborted                = ATABaseErrCode + 0x36,        /* 0xDB78: The I/O queue entry was aborted due to an abort req.*/
  945.                                                                 /*            or due to Manager shutdown.*/
  946.     ATAUnableToAbort            = ATABaseErrCode + 0x37,        /* 0xDB79: The I/O queue entry could not be aborted.*/
  947.     ATAAbortedDueToRst            = ATABaseErrCode + 0x38,        /* 0xDB7A: Request aborted due to a device reset command.*/
  948.     ATAPIPhaseErr                = ATABaseErrCode + 0x39,        /* 0xDB7B: Unexpected phase - •••IS THIS VALID ERROR??? <06/15/94>*/
  949.     ATAPITxCntErr                = ATABaseErrCode + 0x3A,        /* 0xDB7C: Overrun/Underrun condition detected*/
  950.     ATANoClientErr                = ATABaseErrCode + 0x3B,        /* 0xDB7D: No client present to handle the event*/
  951.     ATAInternalErr                = ATABaseErrCode + 0x3C,        /* 0xDB7E: MagnumOpus returned an error*/
  952.     ATABusErr                    = ATABaseErrCode + 0x3D,        /* 0xDB7F: Bus error detected on I/O    */
  953.     AT_NoAddrErr                = ATABaseErrCode + 0x3E,        /* 0xDB80: Invalid AT base adress */
  954.     DriverLocked                = ATABaseErrCode + 0x3F,        /* 0xDB81: Current driver must be removed before adding another*/
  955.     CantHandleEvent                = ATABaseErrCode + 0x40,        /* 0xDB82: Particular event couldn't be handled (call others)*/
  956.     ATAMgrMemoryErr                = ATABaseErrCode + 0x41,        /* 0xDB83: Manager memory allocation error    */
  957.     ATASDFailErr                = ATABaseErrCode + 0x42,        /* 0xDB84: Shutdown failure                */
  958.     ATAXferParamErr                = ATABaseErrCode + 0x43,        /* 0xDB85: I/O xfer parameters inconsistent */
  959.     ATAXferModeErr                = ATABaseErrCode + 0x44,        /* 0xDB86: I/O xfer mode not supported */
  960.     ATAMgrConsistencyErr        = ATABaseErrCode + 0x45,        /* 0XDB87: Manager detected internal inconsistency. */
  961.     ATADmaXferErr                = ATABaseErrCode + 0x46,        /* 0XDB88: fatal error in DMA side of transfer */
  962.                                                                 /* Driver loader error Codes 0xDB90 - 0xDBA5*/
  963.     ATAInvalidDrvNum            = ATABaseErrCode + 0x4E,        /* 0xDB90: Invalid drive number from event*/
  964.     ATAMemoryErr                = ATABaseErrCode + 0x4F,        /* 0xDB91: Memory allocation error*/
  965.     ATANoDDMErr                    = ATABaseErrCode + 0x50,        /* 0xDB92: No DDM found on media    */
  966.     ATANoDriverErr                = ATABaseErrCode + 0x51            /* 0xDB93: No driver found on the media    */
  967. };
  968.  
  969. /* ------------------------    Version 1 definition -------------------------------    */
  970.  
  971. enum {
  972.     v1ATABaseErrCode            = 0x0700,                        /* This needs a home somewhere*/
  973.     v1AT_NRdyErr                = 0x01 - v1ATABaseErrCode,        /* 0xF901: -0x1DBE */
  974.     v1AT_IDNFErr                = 0x04 - v1ATABaseErrCode,        /* 0xF904: -0x1DC0 */
  975.     v1AT_DMarkErr                = 0x05 - v1ATABaseErrCode,        /* 0xF905: -0x1DC0 */
  976.     v1AT_BadBlkErr                = 0x06 - v1ATABaseErrCode,        /* 0xF906: -0x1DC0 */
  977.     v1AT_CorDataErr                = 0x07 - v1ATABaseErrCode,        /* 0xF907: -0x1DC0 */
  978.     v1AT_UncDataErr                = 0x08 - v1ATABaseErrCode,        /* 0xF908: -0x1DC0 */
  979.     v1AT_SeekErr                = 0x09 - v1ATABaseErrCode,        /* 0xF909: -0x1DC0 */
  980.     v1AT_WrFltErr                = 0x0A - v1ATABaseErrCode,        /* 0xF90A: -0x1DC0 */
  981.     v1AT_RecalErr                = 0x0B - v1ATABaseErrCode,        /* 0xF90B: -0x1DC0 */
  982.     v1AT_AbortErr                = 0x0C - v1ATABaseErrCode,        /* 0xF90C: -0x1DC0 */
  983.     v1AT_NoAddrErr                = 0x0D - v1ATABaseErrCode,        /* 0xF90D: -0x1D8D */
  984.     v1AT_MCErr                    = 0x0E - v1ATABaseErrCode,        /* 0xF90E: -0x1DC0*/
  985.                                                                 /* System error codes...Custom Driver Error Codes*/
  986.     v1DRVRCantAllocate            = -(v1ATABaseErrCode + 1),        /* 0xF8FF: -0x1D9F*/
  987.     v1NoATAMgr                    = -(v1ATABaseErrCode + 2),        /* 0xF8FE: -0x1D9D*/
  988.     v1ATAInitFail                = -(v1ATABaseErrCode + 3),        /* 0xF8FD: -0x1D9B*/
  989.     v1ATABufFail                = -(v1ATABaseErrCode + 4),        /* 0xF8FC: -0x1D99*/
  990.     v1ATADevUnsupported            = -(v1ATABaseErrCode + 5),        /* 0xF8FB: -0x1c97*/
  991.                                                                 /* Manager Error Codes*/
  992.     v1ATAMgrNotInitialized        = -(v1ATABaseErrCode + 10),        /* 0xF8F6: -0x1D86*/
  993.     v1ATAPBInvalid                = -(v1ATABaseErrCode + 11),        /* 0xF8F5: -0x1D84*/
  994.     v1ATAFuncNotSupported        = -(v1ATABaseErrCode + 12),        /* 0xF8F4: -0x1D82*/
  995.     v1ATABusy                    = -(v1ATABaseErrCode + 13),        /* 0xF8F3: -0x1D80*/
  996.     v1ATATransTimeOut            = -(v1ATABaseErrCode + 14),        /* 0xF8F2: -0x1D7E*/
  997.     v1ATAReqInProg                = -(v1ATABaseErrCode + 15),        /* 0xF8F1: -0x1D7C*/
  998.     v1ATAUnknownState            = -(v1ATABaseErrCode + 16),        /* 0xF8F0: -0x1D7A*/
  999.     v1ATAQLocked                = -(v1ATABaseErrCode + 17),        /* 0xF8EF: -0x1D78*/
  1000.     v1ATAReqAborted                = -(v1ATABaseErrCode + 18),        /* 0xF8EE: -0x1D76*/
  1001.     v1ATAUnableToAbort            = -(v1ATABaseErrCode + 19),        /* 0xF8ED: -0x1D74*/
  1002.     v1ATAAbortedDueToRst        = -(v1ATABaseErrCode + 20)        /* 0xF8EC: -0x1D72*/
  1003. };
  1004.  
  1005. #if PRAGMA_ALIGN_SUPPORTED
  1006. #pragma options align=reset
  1007. #endif
  1008.  
  1009. #if PRAGMA_IMPORT_SUPPORTED
  1010. #pragma import off
  1011. #endif
  1012.  
  1013. #ifdef __cplusplus
  1014. }
  1015. #endif
  1016.  
  1017. #endif /* __ATA__ */
  1018.  
  1019.